//
//  SubjectView.m
//  BaiYing_Thinker
//
//  Created by 鹏 朱 on 15/11/13.
//  Copyright (c) 2015年 XKJH. All rights reserved.
//

#import "SubjectView.h"
#import "XKO_CreateUIViewHelper.h"

@implementation SubjectView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self addSubview:self.subjectContent];
        [self.subjectContent mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.centerY.equalTo(self.mas_centerY);
            make.centerX.equalTo(self.mas_centerX);
            make.size.mas_equalTo(CGSizeMake(frame.size.width - KLeftMargin*2, frame.size.height - KTopMargin*2));
        }];
    }
    
    return self;
    
}

- (UILabel *)subjectContent {
    
    if (!_subjectContent) {
        
        _subjectContent = [XKO_CreateUIViewHelper createLabelWithFont:[UIFont boldSystemFontOfSize:25] fontColor:KColorText666666 text:@""];
        _subjectContent.backgroundColor = kGetColor(18, 38, 74);
        _subjectContent.numberOfLines = 0;
        _subjectContent.textAlignment = NSTextAlignmentCenter;
    }
    
    return _subjectContent;
}

- (void)setSubjectMessage:(SubjectMessage *)subjectMessage {
    
    if (_subjectMessage != subjectMessage) {
        _subjectMessage = subjectMessage;
        
        self.subjectContent.text = _subjectMessage.content;
    }
}

@end
